package com.wjk.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wjk.feigninstance.MicroServiceClientSayhello;

@RestController
@RequestMapping("consumers")
public class CallMicroServiceClientSayhello {

	private static Logger logger = LoggerFactory.getLogger(CallMicroServiceClientSayhello.class);

	//使用 feign 实现 服务之间调用
	@Autowired
	private MicroServiceClientSayhello microServiceClientSayhello;

	@GetMapping("hello/{name}")
	public String consumersSayHello(@PathVariable String name) {

		logger.info("i am calling micro client say hello .");
		String msg = this.microServiceClientSayhello.hello(name);
		logger.info("call end .msg content is " + msg);

		return "feign :   " + msg;
	}
}
